import 'package:flutter/material.dart';

// 最近访问
class DynamicVisitItemWidget extends StatelessWidget {
  final String avatar; //头像
  final String upName; //up名称
  final bool checked; //是否已读
  const DynamicVisitItemWidget({
    super.key,
    required this.avatar,
    required this.checked,
    required this.upName,
  });
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.only(
        left: 10,
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Padding(
            padding: const EdgeInsets.only(bottom: 8),
            child: Stack(
              children: [
                CircleAvatar(
                  radius: 25,
                  backgroundImage: AssetImage(avatar),
                  backgroundColor: const Color(0xfff4f5fa),
                ),
                checked
                    ? const SizedBox()
                    : Positioned(
                        bottom: 0,
                        right: 0,
                        child: Container(
                          width: 11,
                          height: 11,
                          decoration: BoxDecoration(
                            color: const Color.fromARGB(255, 249, 150, 211),
                            borderRadius: BorderRadius.circular(6),
                            border: Border.all(
                              color: Colors.white,
                              width: 2,
                            ),
                          ),
                        ),
                      )
              ],
            ),
          ),
          Expanded(
            flex: 1,
            child: SizedBox(
              width: 64,
              child: Text(
                upName,
                textAlign: TextAlign.center,
                overflow: TextOverflow.ellipsis,
                maxLines: 2,
                style: const TextStyle(
                  height: 1.1,
                  fontSize: 12,
                  color: Color.fromARGB(255, 87, 87, 89),
                ),
              ),
            ),
          )
        ],
      ),
    );
  }
}
